console.log('加载presentation.js');
myApp.onPageInit('treasure_hunter_presentation', function (page) {
	var actId = $$('#treasure_hunter_presentation').data('actId');
	//加载页面
	$$.ajax({
        url:url_get_treasure_hunter_presentation,
        method:"GET",
		data:{id:actId},
		dataType:'json',
		//xhrFields:{withCredentials:true},
		success: function (ajaxresult) {             
		    if(ajaxresult.code==1){
		  	    //获取活动信息页面数据
		        var data_treasure_hunter_presentation = ajaxresult.data;
		        //console.log(data_treasure_hunter_presentation);
		        
		        //写入活动信息页面模板
		        var html_treasure_hunter_presentation = myApp.treasureHunterPresentationTemplate(data_treasure_hunter_presentation);
		        $$('#treasure_hunter_presentation .page-content').html(html_treasure_hunter_presentation);
		        
		        //图片滚动
		        var treasurehunterpresentationswiper = new Swiper('.swiper-treasure-hunter-presentation', {
		    	  		pagination:".swiper-pagination-treasure-hunter-presentation",
		    	  		loop:true,
		    	  	    autoplay:5000,
		    	  	    autoplayDisableOnInteraction:false
		        });
		        
		        //点击报名
		        $$('#treasure_hunter_presentation .order').on('click',function(){
		      	  var orders = parseInt(data_treasure_hunter_presentation.orders);
		      	  var maxPersons = parseInt(data_treasure_hunter_presentation.maxPersons);
		      	  //console.log(orders,typeof(orders),maxPersons,typeof(maxPersons));
		      	  if(orders < maxPersons){
			      	  //开启loader
			      	  myApp.showIndicator();
			      	  //跳转页面
		      		  mainView.router.load({
		                    "url":"choosePrice.html",
		                    "context":{
		                    	     "actId":data_treasure_hunter_presentation.id,
		                    	     "issueNum":data_treasure_hunter_presentation.issueNum,
		                    	     "actName":data_treasure_hunter_presentation.name,
		                  	         "price":data_treasure_hunter_presentation.price,
		                  	         "priceGroup":data_treasure_hunter_presentation.priceGroup,
		                  	         "priceDetail":data_treasure_hunter_presentation.priceDetail,
		                  	         "priceGroupDetail":data_treasure_hunter_presentation.priceGroupDetail
		                  	        }
		              });
		      	  }else{
		      		  myApp.alert("非常抱歉，本次活动已经报满，十分感谢您的支持！");
		      	  }
		             
		        });
		        //关闭loader
		        myApp.hideIndicator();
		    }else{
		    	//关闭loader
		        myApp.hideIndicator();
		  	    myApp.alert(ajaxresult.msg);
		    }
		}
    });
});
